<?php
/**
 * Created by PhpStorm.
 * User: zhixuan
 * Date: 2019/12/9
 * Time: 14:45
 */

namespace app\admin\controller;

use app\admin\model\Privilege;
use app\admin\model\Role;
class Index extends Base
{
    /*
     * 平台后台首页
     * */
    public function index(){
        //获取顶部菜单
        $privilege = Privilege::getAll(['is_menu'=>1],[]);
        if($this->admin_id == 1){
            $leftMenu = Privilege::getPrivilegeMenu($privilege->toArray());
        }else {
            $role_id = $this->admin_user->role_id;
            $privilege_ids = Role::getRolePrivilege($role_id);
            $leftMenu = Privilege::getPrivilegeMenu($privilege_ids);
        }
        return view('index',['privilege'=>$leftMenu]);
    }

    public function systemIndex(){

        return view('system_index');
    }
}

